package com.baofu.paycore.service.processor.refund;

import com.baofu.paycore.manager.model.RefundBO;
import com.baofu.paycore.service.converter.DTO2BOConverter;
import com.baofu.paycore.service.facade.model.refund.req.RefundReqDTO;
import com.baofu.paycore.service.processor.PayBaseProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 退款主单构建处理器
 * <p>
 *     1、退款主单构建
 * </p>
 * User: kwl Date: 2016/6/4 ProjectName: paycore Version: 5.0.0
 */
@Service
public class RefundProcessor implements PayBaseProcessor<RefundBO,RefundReqDTO> {

    @Autowired
    private RefundFundProcessor refundFundProcessor;

    /**
     * 退款主单构建
     *
     * @param refundBO     支付模型
     * @param refundReqDTO    请求参数
     */
    @Override
    public PayBaseProcessor process(RefundBO refundBO, RefundReqDTO refundReqDTO) {
        //对象封装
        DTO2BOConverter.refundDTO2BO(refundReqDTO,refundBO);
        // 需按顺序执行赋值
        refundFundProcessor.process(refundBO,refundReqDTO);
        return this;
    }
}
